<?php
namespace Home\Controller;
use Common\Controller\HomeBaseController;
use Think\Model;
use Common\Model\ArticleModel;

class ArticleController extends HomeBaseController {
	/*
	 * 文章列表
	 */
	public function lists($cid = NULL) {
		$model = new ArticleModel();
		$map = array();$map['status'] = 1;$map['cate'] = $cid;
		C('LIST_ROWS',C('cfg_linerows'));
		$list = $this->_lists($model,$map,'updatetime DESC');
		//list数据处理
		foreach ($list as &$v) {
			$v['time_type'] =date('Y-m-d H:i:s',$v['updatetime']);
		}
		unset($v);
		$this->assign("list",$list);
		$this->display();
	}
	/*
	 * 文章详情
	 */
	public function info() {
		$model = new ArticleModel();
		$info = $model->find($id);
		$info['time_type'] = date('Y-m-d H:i:s',$info['updatetime']);
		$this->assign('info',$info);
		if ($info) $model->where('id='.$info['id'])->setInc('click');
		$info['hits']++;
		$this->display();
	}
	/*
	 * 用户消息
	 */
	public function msg(){
		$this->display();
	}
}